home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 2 / Apprentice-Release2.iso / Source Code / Pascal / Games / Stella Obscura 1.1 / source / Parts ƒ / AboutIt.p next >
Encoding:
Text File  |  1990-05-13  |  3.5 KB  |  151 lines  |  [TEXT/PJMM]

  1. unit aboutIt;
  2.  
  3. interface
  4.  
  5.     procedure D_aboutIt;
  6.  
  7. implementation
  8.  
  9.     const
  10.         I_Okay = 1;
  11.         I_Static_Text = 2;
  12.         I_Static_Text3 = 3;
  13.         I_Static_Text5 = 4;
  14.         I_Static_Text7 = 5;
  15.         I_Static_Text9 = 6;
  16.         I_Static_Text11 = 7;
  17.         I_Static_Text13 = 8;
  18.         I_Static_Text15 = 9;
  19.         I_Static_Text17 = 10;
  20.         I_Static_Text19 = 11;
  21.         I_Static_Text21 = 12;
  22.         I_Static_Text23 = 13;
  23.         I_Static_Text25 = 14;
  24.         I_Static_Text27 = 15;
  25.         I_Iconx29 = 16;
  26.     var
  27.         ExitDialog: boolean;
  28.  
  29. {===========================================================}
  30.  
  31.     function MyFilter (theDialog: DialogPtr; var theEvent: EventRecord; var itemHit: integer): boolean;
  32.         var
  33.             DoubleClick: boolean;
  34.             MyPt: Point;
  35.             tempRect: Rect;
  36.     begin
  37.         MyFilter := FALSE;
  38.         if (theEvent.what = MouseDown) then
  39.             begin
  40.                 MyPt := theEvent.where;
  41.                 with theDialog^.portBits.bounds do
  42.                     begin
  43.                         myPt.h := myPt.h + left;
  44.                         myPt.v := myPt.v + top;
  45.                     end;
  46.             end;
  47.     end;
  48.  
  49. {===========================================================}
  50.  
  51.     procedure D_aboutIt;
  52.         var
  53.             GetSelection: DialogPtr;
  54.             tempRect: Rect;
  55.             DType: Integer;
  56.             Index: Integer;
  57.             DItem: Handle;
  58.             CItem, CTempItem: controlhandle;
  59.             sTemp: Str255;
  60.             itemHit: Integer;
  61.             temp: Integer;
  62.             Icon_Handle: Handle;
  63.             NewMouse: Point;
  64.             InIcon: boolean;
  65.             ThisEditText: TEHandle;              {Handle to get the Dialogs TE record}
  66.             TheDialogPtr: DialogPeek;            {Pointer to Dialogs definition record, contains the TE record}
  67.  
  68.         procedure Refresh_Dialog;
  69.             var
  70.                 rTempRect: Rect;
  71.         begin
  72.         end;
  73.  
  74.     begin
  75.         GetSelection := GetNewDialog(5, nil, Pointer(-1));
  76.         ShowWindow(GetSelection);
  77.         SelectWindow(GetSelection);
  78.         SetPort(GetSelection);
  79.  
  80.         TheDialogPtr := DialogPeek(GetSelection);
  81.         ThisEditText := TheDialogPtr^.textH;
  82.         HLock(Handle(ThisEditText));
  83.         ThisEditText^^.txSize := 12;
  84.         TextSize(12);
  85.         ThisEditText^^.txFont := systemFont;
  86.         TextFont(systemFont);
  87.         ThisEditText^^.txFont := 0;
  88.         ThisEditText^^.fontAscent := 12;
  89.         ThisEditText^^.lineHeight := 12 + 3 + 1;
  90.         HUnLock(Handle(ThisEditText));
  91.         ExitDialog := FALSE;
  92.         repeat
  93.             ModalDialog(nil, itemHit);
  94.             GetDItem(GetSelection, itemHit, DType, DItem, tempRect);
  95.             CItem := Pointer(DItem);
  96.             if (ItemHit = I_Okay) then
  97.                 begin
  98.                     ExitDialog := TRUE;
  99.                     Refresh_Dialog;
  100.                 end;
  101.             if (ItemHit = I_Iconx29) then
  102.                 begin
  103.                     Icon_Handle := GetIcon(10046);
  104.                     if (Icon_Handle <> nil) then
  105.                         begin
  106.                             EraseRect(tempRect);
  107.                             PlotIcon(tempRect, Icon_Handle);
  108.                         end;
  109.                     InIcon := TRUE;
  110.                     repeat
  111.                         GetMouse(NewMouse);
  112.                         if (PtInRect(NewMouse, tempRect)) then
  113.                             begin
  114.                                 if not (InIcon) then
  115.                                     begin
  116.                                         Icon_Handle := GetIcon(10046);
  117.                                         if (Icon_Handle <> nil) then
  118.                                             begin
  119.                                                 EraseRect(tempRect);
  120.                                                 PlotIcon(tempRect, Icon_Handle);
  121.                                             end;
  122.                                         InIcon := TRUE;
  123.                                     end;
  124.                             end
  125.                         else if InIcon then
  126.                             begin
  127.                                 Icon_Handle := GetIcon(46);
  128.                                 if (Icon_Handle <> nil) then
  129.                                     begin
  130.                                         EraseRect(tempRect);
  131.                                         PlotIcon(tempRect, Icon_Handle);
  132.                                     end;
  133.                                 InIcon := FALSE;
  134.                             end;
  135.                     until not (StillDown);
  136.                     if (PtInRect(NewMouse, tempRect)) then
  137.                         begin
  138.                             Refresh_Dialog;
  139.                         end;
  140.                     Icon_Handle := GetIcon(46);
  141.                     if (Icon_Handle <> nil) then
  142.                         begin
  143.                             EraseRect(tempRect);
  144.                             PlotIcon(tempRect, Icon_Handle);
  145.                         end;
  146.                 end;
  147.         until ExitDialog;
  148.         DisposDialog(GetSelection);
  149.     end;
  150. end.                                    {End of unit}
  151.